<template>
  <div class="app-container">
    <el-form
      :model="queryParams"
      ref="queryForm"
      size="small"
      :inline="true"
      v-show="showSearch"
      label-width="100px"
      class="el-forms"
    >
      <div class="handle_box_content" ref="handle_box_content">
        <!-- <el-form-item label="外键" prop="refId">
        <el-input
          v-model="queryParams.refId"
          placeholder="请输入外键"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
        <el-form-item label="项目id" prop="projectId">
          <el-input
            v-model="queryParams.projectId"
            placeholder="请输入项目id"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="项目名称" prop="projectName">
          <el-input
            v-model="queryParams.projectName"
            placeholder="请输入项目名称"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <!-- <el-form-item label="类别" prop="SORT">
        <el-input
          v-model="queryParams.SORT"
          placeholder="请输入类别"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
        <!-- <el-form-item label="批次编号" prop="batchCode">
        <el-input
          v-model="queryParams.batchCode"
          placeholder="请输入批次编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
        <el-form-item label="器具名称" prop="toolName">
          <el-input
            v-model="queryParams.toolName"
            placeholder="请输入器具名称"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <!-- <el-form-item label="种类序列号" prop="kindNumber">
        <el-input
          v-model="queryParams.kindNumber"
          placeholder="请输入种类序列号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
        <el-form-item label="制造厂家" prop="FACTORY">
          <el-input
            v-model="queryParams.FACTORY"
            placeholder="请输入制造厂家"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="保管负责人" prop="custodyPerson">
          <el-input
            v-model="queryParams.custodyPerson"
            placeholder="请输入保管负责人"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <!-- <el-form-item label="开始时间" prop="startTime">
        <el-date-picker clearable
                        v-model="queryParams.startTime"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="请选择开始时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="结束时间" prop="endTime">
        <el-date-picker clearable
                        v-model="queryParams.endTime"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="请选择结束时间">
        </el-date-picker>
      </el-form-item> -->
        <el-form-item label="管理责任人" prop="managePerson">
          <el-input
            v-model="queryParams.managePerson"
            placeholder="请输入管理责任人"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="检验结果" prop="results">
          <el-input
            v-model="queryParams.results"
            placeholder="请输入检验结果"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <!-- <el-form-item label="检验日期" prop="inspectDate">
        <el-date-picker clearable
                        v-model="queryParams.inspectDate"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="请选择检验日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="下次检验日期" prop="nextInspectDate">
        <el-date-picker clearable
                        v-model="queryParams.nextInspectDate"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="请选择下次检验日期">
        </el-date-picker>
      </el-form-item> -->
        <!-- <el-form-item label="备注" prop="REMARK">
        <el-input
          v-model="queryParams.REMARK"
          placeholder="请输入备注"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      </div>
      <el-form-item>
        <el-button
          type="primary"
          icon="el-icon-search"
          size="mini"
          @click="handleQuery"
          >搜索</el-button
        >
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
          >重置</el-button
        >
        <el-button
          plain
          size="mini"
          :icon="Showbox ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"
          @click="handleShow"
          >{{ Showbox ? "隐藏" : "展开" }}</el-button
        >
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          v-hasPermi="['system:manger:export']"
          >导出</el-button
        >
      </el-col>
      <right-toolbar
        :showSearch.sync="showSearch"
        @queryTable="getList"
      ></right-toolbar>
    </el-row>

    <el-table
      v-loading="loading"
      :data="mangerList"
      @selection-change="handleSelectionChange"
      @row-click="handleRowClick"
      ref="table"
      border
    >
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="评审事件" align="center" width="130" prop="reviewEvents" sortable/>
      <el-table-column label="项目名称" align="center" prop="evaluationElements" />
      <el-table-column label="标准分" align="center" prop="reviewStandardScore" />
      <el-table-column label="应得分" align="center" prop="reviewStandardScore" />
      <el-table-column label="实得分" align="center" prop="deduct" />
      <el-table-column label="发现问题" align="center" prop="problem" />
      <el-table-column label="得分率" align="center" prop="remark" />
    </el-table>

   <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>

<script>
import {
  listDetails,
  getEvaluation,
  delEvaluation,
  addEvaluation,
  updateEvaluation,
  problemRectificationList
} from '@/api/system/review/evaluation'
import PeopleSelect from "../../../components/Selection/index.vue"
import DepartmentDialog from "../../../components/DepartmentDialog/index.vue"
export default {
  name: "Manger",
  dicts: ["sys_normal_disable"],
  components: {
    PeopleSelect,
    DepartmentDialog
  },
  data() {
    return {
      // 按钮loading
      // buttonLoading: false,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 工器具管理表格数据
      mangerList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        reviewEvents: undefined,
        evaluationElements: undefined,
        examinerCode: undefined,
        examiner: undefined,
        isApply: undefined,
        lookWorkCase: undefined,
        evaluateCase: undefined,
        isInnovate: undefined,
        evaluateObject: undefined,
        backingMaterial: undefined,
        lookPapersCase: undefined,
        deduct: undefined,
        isProblem: undefined,
        problem: undefined,
        isGreatProblem: undefined,
        rectifySuggest: undefined,
        scenePhoto: undefined,
        reviewStatus: undefined,
        reviewStandard: undefined,
        scoreStandard: undefined,
        isDelete: undefined,
        evaGroupId: undefined,
        deptCode: undefined,
        deptName: undefined,
        responsibleCode: undefined,
        responsibleName: undefined,
        requireOkTime: undefined,
        okTime: undefined,
        requireSituation: undefined,
        okPhoto: undefined,
        reviewStandardScore: undefined,
      },
      // 表单参数
      form: {},
      Showbox:false,
      peopleOpen:false,
      peopleOpen1:false,
      // 表单校验
      rules: {
        ID: [{ required: true, message: "主键id不能为空", trigger: "blur" }],
        refId: [{ required: true, message: "外键不能为空", trigger: "blur" }],
        projectId: [
          { required: true, message: "项目id不能为空", trigger: "blur" },
        ],
        projectName: [
          { required: true, message: "项目名称不能为空", trigger: "blur" },
        ],
        SORT: [{ required: true, message: "类别不能为空", trigger: "blur" }],
        batchCode: [
          { required: true, message: "批次编号不能为空", trigger: "blur" },
        ],
        toolName: [
          { required: true, message: "器具名称不能为空", trigger: "blur" },
        ],
        kindNumber: [
          { required: true, message: "种类序列号不能为空", trigger: "blur" },
        ],
        TYPE: [{ required: true, message: "型号不能为空", trigger: "change" }],
        FACTORY: [
          { required: true, message: "制造厂家不能为空", trigger: "blur" },
        ],
        custodyPerson: [
          { required: true, message: "保管负责人不能为空", trigger: "blur" },
        ],
        startTime: [
          { required: true, message: "开始时间不能为空", trigger: "blur" },
        ],
        endTime: [
          { required: true, message: "结束时间不能为空", trigger: "blur" },
        ],
        managePerson: [
          { required: true, message: "管理责任人不能为空", trigger: "blur" },
        ],
        RESULTS: [
          { required: true, message: "检验结果不能为空", trigger: "blur" },
        ],
        inspectDate: [
          { required: true, message: "检验日期不能为空", trigger: "blur" },
        ],
        nextInspectDate: [
          { required: true, message: "下次检验日期不能为空", trigger: "blur" },
        ],
        REMARK: [{ required: true, message: "备注不能为空", trigger: "blur" }],
        FILE: [
          { required: true, message: "附件信息不能为空", trigger: "blur" },
        ],
      },
    };
  },
  created() {
    this.getList();
  },
  methods: {
    open1() {
      this.peopleOpen = true;
    },
    open2() {
      this.peopleOpen1 = true;
    },
    //选择人的确定按钮事件 submitPeople(nikeNamelist)方法传参一个默认接收用户昵称数组   submitPeople(peopleList,nikeNamelist)方法传参两个则是接收用户昵称数组和用户账号数组
    submitPeople(peopleList) {
      //console.log(peopleList);
      this.peopleOpen = false;
    },
    submitPeople1(peopleList) {
      //console.log(peopleList);
      this.peopleOpen1 = false;
    },
     handleRowClick(row) {
      this.$refs.table.toggleRowSelection(row);
    },
    handleShow() {
      this.Showbox = !this.Showbox
      const element = this.$refs.handle_box_content;
      if(this.Showbox){
        element.style.overflow = 'visible';
        element.style.height = 'fit-content'
      }else {
        element.style.overflow = 'hidden';
        element.style.height = '50px'
      }
    },
    /** 查询工器具管理列表 */
    getList() {
      this.loading = true;
      listDetails(this.queryParams).then((response) => {
        //console.log(response);
        //console.log("-----------")
        this.mangerList = response;
        //console.log(this.mangerList);
        // this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        ID: undefined,
        refId: undefined,
        projectId: undefined,
        projectName: undefined,
        SORT: undefined,
        batchCode: undefined,
        toolName: undefined,
        kindNumber: undefined,
        TYPE: undefined,
        FACTORY: undefined,
        custodyPerson: undefined,
        startTime: undefined,
        endTime: undefined,
        managePerson: undefined,
        RESULTS: undefined,
        inspectDate: undefined,
        nextInspectDate: undefined,
        REMARK: undefined,
        FILE: undefined,
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.id);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
  },
};
</script>
<style>
.handle_box_content {
  width: 81%;
  height: 50px;
  overflow: hidden;
}
.el-forms{
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
}
</style>
